/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef ORDERED_READER_H
#define ORDERED_READER_H

#include <resource/Resource.h>

inline short int read_short_little_endian( resource::Resource * res )
{
	unsigned char buf[2];
	res->read( buf, 2 );
	short int val = buf[0];
	val |= (buf[1] << 8);
	return val;
}

inline unsigned read_long_little_endian( resource::Resource * res )
{
	unsigned char buf[4];
	res->read( buf, 4 );
	return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
}


#endif //ORDERED_READER_H